package com.itheima.chapter08.set.HashSet;

import java.util.HashSet;

//HashSet存储学生对象并遍历
public class demo2 {
    public static void main(String[] args) {
        HashSet<Student> hs =new HashSet<>();
        Student s1 =new Student("zhangsan",23);
        Student s2 =new Student("lisi",24);
        Student s3 =new Student("wangwu",31);
        Student s4 =new Student("zhanli",26);
        hs.add(s1);
        hs.add(s2);
        hs.add(s3);
        hs.add(s4);
        System.out.println(hs);
        for (Student h : hs) {
            System.out.println(h);
        }
    }
}
